home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / CLiCC-CodeWarrior-0.6.2 / CLiCC⁄CodeWarrior 0.6.2 README < prev    next >
Encoding:
Text File  |  1994-09-12  |  7.7 KB  |  154 lines  |  [TEXT/ttxt]

  1. MacCLiCC 0.6.2
  2. ==============
  3.  
  4. Here are a few notes about the MCL 2.0.1 port of CLiCC, the University of Kiel’s
  5. Common Lisp to C compiler.
  6.  
  7. In the interest of space (specifically, so I could get the StuffIt archive to
  8. fit on one high-density floppy), I’ve removed various UNIX/non-MCL files such
  9. as makefiles, installation notes, and so on.  Kiel had also begun to experiment
  10. with an alternative object-representation system, but as of this writing, it
  11. only works with GNU C, so I removed that as well.  I did, of course, leave Kiel’s
  12. copyright notice intact.  If any of this bothers anyone, the FTP site for the
  13. original archive in its entirety is given at the end of this file.
  14.  
  15. First, you should read all of the README’s in the various subdirectories,
  16. although I’ll attempt to provide all of their critical information in this file.
  17.  
  18. The Common Lisp code is CLtL1, and the C code is K&R; keeping these two facts in
  19. mind is really all that’s necessary to port the code.
  20.  
  21. Porting the Lisp portion of the code turned out to be a relatively simple
  22. matter of adding a few #+:mcl conditionalizations to the code here and there.
  23. Most of them (and there aren’t that many) are in clcload.lisp, in the
  24. :src:compiler: folder.  Basically, I
  25.  
  26. • Load the CLtL1 compatibility library
  27. • Add the directory of the current-loading file to the module search path so
  28.   that (require …) doesn’t freak
  29. • Import a variety of CLOS symbols into the CLICC package because they wind up
  30.   being unbound as far as the CLICC compiler is concerned otherwise
  31. • Add a binding for *default-pathname-defaults* to the CLICC function so that
  32.   (require …) can find files in the home: logical host (very helpful for when
  33.   you drag the main source file to the CLiCC application and the file require's
  34.   other files in the same folder)
  35. • Conditionalize the setup-clcload-pathnames function.
  36.  
  37. In config.lisp, I
  38.  
  39. • Provide definitions for *CLICC-PATH-STRING*, *LISP-DEF*, and *SYS-DEF*.
  40.  
  41. That’s it.  All you need to do to build the CLiCC compiler, then, is fire up
  42. MCL 2.0.1, get it set up the way you like, then load :src:compiler:clcload.lisp.
  43. When it’s done loading, you should probably (in-package :user), then
  44. (save-application "CLiCC" :init-file "init").  To use the compiler, the easiest
  45. thing to do is to drag a .lisp file to your CLiCC compiler, which has the effect
  46. of making the home: logical host refer to the folder containing the .lisp file.
  47. Then type (clicc "main.lisp") or what have you and let ’er rip (be sure to read
  48. the docs to see all of the keyword parameters to the clicc function; you may
  49. want/need to use some of them).
  50.  
  51. Now for the runtime system (:src:runtime:c: and :src:runtime:lisp2c:).
  52.  
  53. It’s huge, on the order of a million and a third lines of C.  Don’t be daunted,
  54. though.  I’ve already created CodeWarrior 1.0a2 PowerPC projects for the three
  55. libraries in :src:runtime:c: and the one in :src:runtime:lisp2c: so that’s one
  56. less thing for you to worry about.
  57.  
  58. You will need to copy inline.h, lisp.def, lisp.h, and lisp.syntax from the
  59. :src:runtime:lisp2c: folder to the :lib: folder. 
  60.  
  61. Actually, :src:runtime:c: only contains two .µ files and an additional .h file
  62. of my own creation, nomain.h.  To build the main.lib, initialize.lib, and
  63. rtc.lib files:
  64.  
  65. • Open main.µ with CodeWarrior C/C++ PPC 1.0a2
  66. • Select CodeWarrior’s preferences via the toolbar or Edit menu
  67. • Select “Language” in the preferences dialog’s icon list
  68. • Make sure that the “Prefix File” field is empty
  69. • “OK” the dialog away.  You’ll be warned about the need to recompile if you
  70.   actually changed the configuration.  “OK” this away, too
  71. • Select “Build Library” from the Project menu, and name the library “main.lib”
  72.  
  73. Repeat the above, but ensure that the “Prefix File” field contains “nomain.h”
  74. and name the resulting library “initialize.lib”.  The story here is that CLiCC
  75. can produce either entire programs (i.e. with a main function, and presumably
  76. using stdio) or modules that don’t have a main, and are suitable for linking
  77. into other code.  Put main.lib in your project in the first case, and
  78. initialize.lib in for the second.
  79.  
  80. Now open rtc.µ.  There’s nothing weird about it at all, so just select “Build
  81. Library” from the Project menu and name the library “rtc.lib”.
  82.  
  83. Next open rtl.µ, in the :src:runtime:lisp2c: folder.  It’s gargantuan, so be
  84. patient.  There’s nothing weird about it but its size, so select “Build Library”
  85. from the Project menu and go eat dinner--at least if you’re using a Quadra 800
  86. like I am.  If, on the other hand, you’re using a Power Macintosh 8100/80, lucky
  87. dog, then go get a cup of coffee--maybe.  When it’s done, name the resulting
  88. library “rtl.lib”.
  89.  
  90. Incidentally, for those who are interested in the bootstrapping process, rtl.lib
  91. was the biggest thorn in my side.  First of all, there was a struct and a set
  92. of macros involving the struct that, while apparently valid K&R C, just weren’t
  93. getting past either CodeWarrior or Symantec.  Specifically, trying to declare
  94. an open array of these structs and initialize the array with char *’s cast to
  95. longs for the sake of the struct wasn’t working.  Oddly, redefining the struct
  96. to include char *’s instead of longs and casting the various longs to char *’s
  97. when necessary works just fine.
  98.  
  99. Also, a large number of the .c files in rtl.lib redefine functions, and not
  100. always with exactly the same code.  I’ve used MPW Link-like rules to weed these
  101. out of the project: I kept the first occurrance.  Generally the first one has
  102. seemed to be the larger of the two when there’s been a difference, perhaps due
  103. to error-checking or something that’s missing in the other version.  It’s quite
  104. possible, even likely, that these duplicate definitions are the result of
  105. CLiCC self-compiling using different settings.  Unfortunately, as far as I can
  106. tell, the makefiles from the UNIX version of CLiCC just compile and link all
  107. .c files and the duplicate definitions somehow get automagically weeded out--
  108. probably by causing link warnings rather than errors.  Hence my approach of
  109. keeping the first occurrance.
  110.  
  111. Finally, given the addition of :lib: to the search path for the project, and the
  112. checking of the “Treat <…> as "…"” checkbox, CodeWarrior insisted on finding
  113. its PowerPC C++ Runtime library source file startup.c instead of the startup.c
  114. that belongs to rtl.lib, so I renamed rtl’s startup.c to lstartup.c and replaced
  115. its entry in the project.
  116.  
  117. If you have the CLiCC application, the rtc.lib library, the main.lib library,
  118. the initialize.lib library, and the rtl.lib library, then you have a fully-built
  119. CLiCC system, and you’re loaded for bear.
  120.  
  121. Go ahead; take it for a spin.  Open up :src:test: and drag testmain.lisp onto
  122. the CLiCC application.  Once it’s launched, type (clicc "testmain.lisp") and
  123. watch the messages fly by.  Quit CLiCC when it’s done, and open testmain.µ in
  124. CodeWarrior C/C++ PPC 1.0a2.  Go ahead and build the app(!) and take it for a
  125. test drive.
  126.  
  127. Final words: I’d have provided 68K CodeWarrior projects, too, but even with the
  128. ANSI 250193 release of the ANSI libraries from Metrowerks, model far versions
  129. are not included, so the linker chokes on the size of the data and a number of
  130. the 16-bit code offsets to functions.  Hopefully DR2 will provide either a) all
  131. possible configurations of the libraries or b) source code for the libraries
  132. (although since they’re licensed from Plum Hall Associates, I doubt the latter).
  133.  
  134. TO DO
  135. =====
  136.  
  137. If anyone wants to help with these... ;-)
  138.  
  139. • Provide support for MCL’s autoloading toolbox-call/interface-file scheme
  140. • Provide libraries for MCL’s class library--check CD-ROM additional sources to
  141.   see if Cambridge provided enough, or possibly wheedle sources from Cambridge
  142.  
  143. CREDITS
  144. =======
  145.  
  146. Kiel wrote it; I got it from ftp.informatik.uni-kiel.de in kiel/apply.  If it
  147. works, thank them.  If it doesn’t, blame me.  I’m:
  148.  
  149. Paul Snively
  150. 1079 Inverness Way
  151. Sunnyvale, CA  94087
  152. (408) 247-5118
  153. chewy@shell.portal.com
  154.